//
//  ContactsViewController.m
//  UI0508__通讯录作业
//
//  Created by dllo on 16/6/17.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ContactsViewCell.h"


@implementation ContactsViewCell

- (void)dealloc{
    
    [_myLabelNames release];
    [_myLabelNumber release]; // 写myName 这边不显示 只显示 myN
    [_myImageView release];
    [super dealloc];
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self doIt];
    }
    return self;
}


- (void)doIt {
    
    self.myLabelNames = [[UILabel alloc] init];
    self.myLabelNames.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.myLabelNames];
    [_myLabelNames release];
    
    self.myLabelNumber = [[UILabel alloc] init];
    self.myLabelNumber.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.myLabelNumber];
    [_myLabelNumber release];
    
    
    self.myImageView = [[UIImageView alloc] init];
    self.myImageView.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.myImageView];
    self.myImageView.layer.masksToBounds = YES;
    self.myImageView.layer.cornerRadius = 60;
    [_myImageView release];
    
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.myImageView.frame = CGRectMake(10, 10, 120, 120);
    self.myLabelNames.frame = CGRectMake(150, 30, 200, 30);
    self.myLabelNumber.frame = CGRectMake(150, 90, 200, 30);   
}


- (void)setListmodel:(ListModel *)listmodel{
    if (_listmodel != listmodel) {
        [_listmodel release];
        _listmodel = [listmodel retain];
       
    }
    
    self.myLabelNames.text = listmodel.name;
     self.myLabelNumber.text = listmodel.number;
    self.myImageView.image = [UIImage imageNamed:listmodel.header];
    
    
}








@end
